<?php
if ( !defined( "IN_OP_CEN" ) )
{
    exit( "You can't access this file directly...." );
}
$gametype = intval( getvar( "gametype" ) );
$chkGametype = chkGametype( $gametype );
if ( $chkGametype )
{
    exit();
}
require_once( "class/CheckMode_6.php" );
$chk = new CheckMode_6( $curruser['acl'], 1, $gametype );
$chk->checkShow6Page( 2 );
unset( $chk );
include_once( "centralize/centralize_class/config_cen.php" );
include_once( "centralize/centralize_class/db_cen.php" );
$cid = intval( getvar( "cid" ) );
if ( !isset( $g_cen_info[$cid] ) )
{
    exit( " error cid " );
}
$now_list_chk = " ※ 指定操盘站别:";
$now_list = "";
$now_list .= " ※ 目前站别:<strong>".$g_cen_info[$cid]['siteName']."</strong> || ";
$dbcen = new DB_CEN( $cid );
foreach ( $g_cen_info as $key => $val )
{
    $conStatFlag = $dbcen->chkCidConnect( $key );
    if ( $key == $cid )
    {
        $cls = "row2";
        if ( $conStatFlag )
        {
            exit( "error db connect - ".$cid );
        }
    }
    else
    {
        $cls = "row1";
    }
    $sName = $val['siteName'];
    if ( $conStatFlag )
    {
        $now_list .= "※ <span class='red'>{$sName}(连线异常,请尽快通知系统管理者)</span>";
        $now_list_chk .= " <label>ｘ{$sName}</label>";
    }
    else
    {
        $now_list .= "※ <a href='op.php?op=centralize&fp=op_cen&cen=now_6h&gametype=0&cid={$key}' class='{$cls}'>{$sName}</a>";
        $now_list_chk .= " <label><input type='checkbox' name='cen_id[]' value='{$key}' />{$sName}</label>";
        break;
    }
}
$now_list .= " || ".$now_list_chk;
$now_list = "<div class='msgBox-yellow' style='width:990px;text-align:left;'>".$now_list."</div>";
$dbcen->setCid( $cid );
$dbcen->connect();
$ui = new UI();
$conf = new Config();
$rs = getdb_cen( $cid, "select id,round,open from lotto where open>='".date( "Y-m-d" )."' order by open" );
if ( $rs->eof )
{
    $ui->showErrorPage( "<p>目前没有期数！</p>" );
    exit();
}
$lotto_id = $rs->f['id'];
$round = $rs->f['round'];
$open = $rs->f['open'];
$rs->close();
$tpl = new Template2();
$tpl->set( array( "now_list" => $now_list, "siteName" => $g_cen_info[$cid]['siteName'], "input_cid" => "<input type=\"hidden\" name=\"cid\" value=\"".$cid."\" />", "cid" => $cid ) );
$tpl->set( array( "lotto_id" => $lotto_id, "round" => d3( $round ), "open" => $open ) );
$waitbet = $conf->get( "waitbet" );
$stopbet = $conf->get( "stopbet" );
$t1 = strtotime( $open." ".$stopbet );
$t2 = strtotime( $open." ".$waitbet );
$tpl->Set( "timestap", $t1 - systime( ) );
$tpl->set( "phptime", systime( ) );
$g_risk_value = isset( $g_risk_value ) ? $g_risk_value : 500000;
$g_risk_value = 0 - $g_risk_value;
$bo1 = isset( $_COOKIE['bo1'] ) ? $_COOKIE['bo1'] : 42;
$bo2 = isset( $_COOKIE['bo2'] ) ? $_COOKIE['bo2'] : $g_risk_value;
$tpl->set( "bo1", $bo1 );
$tpl->set( "bo2", $bo2 );
$chkhint = !( $conf->get( "stopbet" ) <= date( "Hi" ) ) || !( $conf->get( "protect_start" ) == 1 ) || isset( $_COOKIE['chkhint'] ) ? $_COOKIE['chkhint'] : false;
if ( $chkhint )
{
    $tpl->set( "chint0", "checked" );
}
$chksound = isset( $_COOKIE['chksound'] ) ? $_COOKIE['chksound'] : false;
if ( $chksound )
{
    $tpl->set( "chint1", "checked" );
}
$tpl->set( "cid", $cid );
include_once( "class_6h/class.menu.php" );
$fieldArr = array( "round" => $round, "open" => $open, "lotto_id" => $lotto_id, "split_id" => 1 );
$onlineMenu = new menu_6h( 3, $fieldArr );
$selectid = getvar( "select" ) == "" ? 0 : getvar( "select" );
$menuList = $onlineMenu->getMenu( $selectid );
$tpl->set( array( "menu_list_url" => $menuList, "gametypeStr" => $onlineMenu->menuArr[$selectid][0], "playtypestr" => $onlineMenu->menuArr[$selectid][2], "slc" => $selectid ) );
unset( $onlineMenu );
$tpl->load( "main", "now_6h.htm" );
$tpl->set( "jslang", $g_conf['language'] );
$tpl->show( "main" );
$ui->footer();
?>